#include "stdafx.h"
#include "FlashSite.h"
#include "FlashView.h"

HRESULT STDMETHODCALLTYPE FlashSite::GetWindowContext( IOleInPlaceFrame __RPC_FAR *__RPC_FAR *ppFrame, IOleInPlaceUIWindow __RPC_FAR *__RPC_FAR *ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo )
{
	RECT rect;
	rect.left = 0;
	rect.top = 0;
	SIZE szOwner = {0 , 0};
	if (m_owner)
	{
		m_owner->GetSize(&szOwner);
	}
	rect.right = szOwner.cx;
	rect.bottom = szOwner.cy;
	*lprcPosRect = rect;
	*lprcClipRect = rect;
	*ppFrame = NULL;
	QueryInterface(__uuidof(IOleInPlaceFrame), (void**)ppFrame);		
	*ppDoc = NULL;
	lpFrameInfo->fMDIApp = FALSE;
	lpFrameInfo->hwndFrame = 0;
	lpFrameInfo->haccel = 0;
	lpFrameInfo->cAccelEntries = 0;
	return S_OK;
}

HRESULT STDMETHODCALLTYPE FlashSite::InvalidateRect( LPCRECT pRect, BOOL fErase )
{	
	if (m_owner)
	{
		m_owner->Update(pRect);
	}
	return S_OK;
}

HRESULT STDMETHODCALLTYPE FlashSite::InvalidateRgn( HRGN hRGN, BOOL fErase )
{	
	if (m_owner)
	{
		RECT rect;
		::GetRgnBox(hRGN, &rect);
		m_owner->Update(&rect);
	}
	return S_OK;
}